let http = require("http");
let url = require("url");

function start(route, getTree) {
    function onRequest(request, response) {
        let pathname = url.parse(request.url).pathname;
        console.log("Request for " + pathname + " received.");
        route.handleUrl(pathname, response);
    }
    http.createServer(onRequest).listen(8088);
    console.log("Server has started.");
}

exports.start = start;